<template>
	<view>
		<view class=" u-p-r-30 u-p-l-30">
			<view class="content wrap">
				<u-form>
					<u-input v-model="operateName2" placeholder="选择项目" type="select" @click="getO2()"/>
					<u-form-item label="预约日期" label-width="170" left-icon="calendar"><u-input v-model="arriveTime" placeholder="选择日期" type="select" @click="getT3()"/></u-form-item>
				</u-form>
			</view>
		</view>
		<u-card padding="16" v-for="(item,index) in dataList" :key="index">
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="9" text-align="left">
							<view class="u-line-1 weikaishi2">
								<span>月台：{{item.railwayPlatformName}}</span>
							</view>
						</u-col>
						<u-col span="3" text-align="right" v-if="item.state == '空闲'">
							<view class="u-line-1 weikaishi3 yiwancheng">
								<span>空闲</span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<view class="" slot="body">
				<view class="wrap">
					<u-row v-for="(item1,index1) in item.list" :key="index1">
						<u-col span="12" text-align="left" v-if="item1.makeType == '提货预约'">
							<view class="u-line-1 u-m-t-15 weikaishi3 lanse">
								<span>预约类型：{{item1.makeType}}</span>
							</view>
						</u-col>
						<u-col span="12" text-align="left" v-else>
							<view class="u-line-1 u-m-t-15 weikaishi3 jinxingzhong">
								<span>预约类型：{{item1.makeType}}</span>
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="u-line-1 weikaishi u-m-t-2">
								<span>车牌号：{{item1.carNumber}}</span>
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="u-line-1 weikaishi u-m-t-2">
								<span>体积：{{item1.volume}}</span>
							</view>
						</u-col>
						<u-col span="12" text-align="left">
							<view class="u-line-1 u-m-t-2">
								<span>抵达时间：{{item1.arriveTime}}</span>
							</view>
						</u-col>
						<u-col span="12" text-align="left">
							<view class="u-line-1 u-m-t-2">
								<span>离开时间：{{item1.leaveTime}}</span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
		</u-card>
		<view>
			<u-select v-model="show2o2" :list="olist" @confirm="confirmo2"></u-select>
		</view>
		<view>
			<u-calendar v-model="show3" mode="date" max-date="2070-01-01" @change="change"></u-calendar>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flex:'',
				pageNo: 1,
				hasMore: true,
				orderCount: 0,
				dataList: [],
				show3:false,
				arriveTime:'',
				operateId2:'',
				operateName2:'',
				olist:[],
				show2o2:false,
			}
		},
		onLoad(open) {
			//#ifdef H5 || APP-PLUS
			this.flex = 'u-flex'
			//#endif
			
			let year = new Date().getFullYear();//年
			let month = new Date().getMonth() + 1;//注意！月份是从0月开始获取的，所以要+1;
			let day = new Date().getDate();//日
			this.arriveTime =  year + '-' + (month >= 10 ? month : '0' + month) + '-' + (day >= 10 ? day : '0' + day);
			
			this.$http.post('/rest/operate/findme',{
			},{
				params: {
				},
				header: {
					'Authorization' :uni.getStorageSync('token'),
				}
			}).then(res => {
				if(res.data.data != '' && res.data.data != null){
					this.operateId2 = res.data.data.id
					this.operateName2 = res.data.data.operateName
					this.refresh()
				}
			})
			
			this.$http.post('/rest/operate/list3',{
			},{
				params: {},
				header: {
					'Authorization' :uni.getStorageSync('token'),
				}
			}).then(res => {
				for(let item1 of res.data.data) {
					let obj = {}
					obj.value = item1.id
					obj.label = item1.operateName
					this.olist.push(obj)
				}
			})
		},
		onPullDownRefresh() {
			this.refresh()
			uni.stopPullDownRefresh()
		},
		methods: {
			confirmo2(e) {
				this.operateId2 = e[0].value
				this.operateName2 = e[0].label
				this.refresh()
			},
			getO2(){
				this.show2o2 = true
			},
			change(e) {
				this.arriveTime = e.result
				this.refresh()
			},
			getT3(){
				this.show3 = true
			},
			refresh(){
				uni.showLoading({
					title: '加载中...'
				})
				this.$http.post('/rest/railwayPlatform/yilist',{
				},{
					params: {
						arriveTime:this.arriveTime,
						operateId:this.operateId2,
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					uni.hideLoading()
					this.dataList = res.data.data
				})
			},
		},
	}
</script>

<style>

</style>
